#include <stdio.h>

int dayofweek(int y, int m, int d)
{
    if (m == 1 || m == 2) {
        --y;
        m += 12;
    }

    return (y + y/4 - y/100 + y/400 + (13*m+8)/5 +d) % 7;
}

int main(void)
{
    int y, m, d, w;

    char *ws[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};


    char a[8];

    sprintf(a, "aaaaaaa");
    puts(a);
    sprintf(a, "bbbb");
    puts(a);


    printf("hehe:%s\n", a);

    printf("求星期.\n");
    printf("年: "); scanf("%d", &y);
    printf("月: "); scanf("%d", &m);
    printf("日: "); scanf("%d", &d);

    w = dayofweek(y, m, d);

    printf("这一天是星期%s.\n", ws[w]);

    return 0;
}
